package cn.net.shuxing.yifu.common.mapper;

import cn.net.shuxing.yifu.common.bean.CoinRatio;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.math.BigDecimal;

public interface CoinRatioMapper extends Mapper<CoinRatio> {

    @Select("select value from coin_ratio where name = #{name} and coin_type_id = #{coinTypeId} and ((#{count} >= low and #{count} <= high) or (#{count} >= low and high = -1))")
    BigDecimal getValue(@Param("name") String name, @Param("coinTypeId") Integer coinTypeId, @Param("count") BigDecimal count);
}
